<?php
namespace App\Event\Shop;

use App\Event\Event;
use App\Repository\UserRepository;
use App\Repository\ShopRepository;

// 店铺创建
class CreateEvent extends Event
{
    public $shop;
    
    public $user;
    
    public $toShop;
    
    public function __construct($shop)
    {
        $this->shop = $shop;
        $this->user = UserRepository::make($this->shop->user);
        
         // 上级用户的店铺
        if($user = $this->shop->user->user)
        {
            if($user->shop)
            {
                $this->toShop = ShopRepository::make($user->shop);
            }
        }
    }
}